<?php
require_once 'CMS/Util.php';
require_once 'CMS/Mvc/BaseController.php';
require_once 'CMS/Mvc/BaseUserController.php';
require_once 'CMS/UserCommon.php';
require_once 'CMS/Language.php';
require_once 'CMS/User.php';

//Người tạo: Nguyễn Huỳnh Đại Thành - Team 3
//Module 	: Support online
//Chức năng	: Quản lý việc hỗ trợ trực tuyến

class SupportOnline_AddController extends BaseUserController{

	public function init(){
		parent::init();
		$this->_helper->layout->disableLayout();	
	}
	
	//Chức năng show các thuộc tính hiện tại cho người dùng
	public function indexAction(){
		/*========== Start Load Language ==========*/
		$language = new Language(APPLICATION_PATH . '/widgets/supportonline');
		if(isset($_SESSION['language']))
		{
			$language_id = $_SESSION['language'];
			$tbLanguage = new Language_Model_Language();
			$name = $tbLanguage->getNameLanguage($language_id);
			$language->load($name['name']);
		}
		else
			$language->load('Default');		
		/*========== End Load Language ==========*/
			/*=========== Get all languages =============*/
			$all_languages = $tbLanguage->getAllLanguages();
			$languages = array();
			foreach ($all_languages as $lang){
				$languages[] = array(
									'id' 	=> $lang['language_id'],
									'name'	=> $lang['name']
									);
			}
			$this->view->languages = $languages;
		/*=========== End get ==================*/	
		/*========== Start Get Text ==============*/
		$this->view->textInfoUser 	= $language->get('text_infouser');
		$this->view->textName 		= $language->get('text_name');
		$this->view->textAdd 		= $language->get('text_add');
		$this->view->textPos	 	= $language->get('text_pos');
		$this->view->textYahoo 		= $language->get('text_Yahoo');
		$this->view->textSkype 		= $language->get('text_Skype');
		$this->view->textPhone 		= $language->get('text_phone');
		$this->view->textError1 	= $language->get('text_error_6');
		$this->view->textError2 	= $language->get('text_error_7');
		$this->view->textError3 	= $language->get('text_error_8');
		$this->view->textError4 	= $language->get('text_error_9');
		$this->view->textError10 	= $language->get('text_error_10');
		$this->view->text_default 	= $language->get('text_default');
		$this->view->text_English 	= $language->get('text_English');
		$this->view->text_Vietnamese= $language->get('text_Vietnamese');
		/*========== End Text ==============*/
		
		$xmlconfig = new SimpleXMLElement($path."config.xml",null,true);//Read config.xml
		$user = new User();
			$user->init();
			$user->check_login();
			$hasmodify = $user->modifiy_widget($xmlconfig->name);
		if($hasmodify=="true")
		{
		}
		else 
		{
			$this->view->error = 2 ;
		}
	}
	

}